fix(steps): add missing props, fix a11y, replace hardcoded colors#8507
fix(steps): add missing props, fix a11y, replace hardcoded colors#8507tangjinzhou merged 3 commits intovueComponent:feat/vaporfrom
Conversation
- types.ts: add progressDot, items, responsive, inline type, icon prop, ProgressDotRender type, StepItem interface, remove size default to allow ConfigProvider inheritance - Steps.vue: integrate useConfigInject for global size, useBreakpoint for responsive auto-vertical, support items prop via v-for, add inline/dot CSS classes, pass initial/progressDot/type via context - Step.vue: conditional role="button" only when clickable, support icon prop rendering, progressDot dot icon, initial offset in step numbering - style/index.css: replace 3x hardcoded #fff with CSS variables for dark theme support, add progressDot and inline type styles - tests: add Inline demo to demo.test.ts, add 7 new test cases for inline type, progressDot, items prop, initial offset, dot icon, conditional role, component names Co-Authored-By: Cursor <noreply@cursor.com> Made-with: Cursor
|
Note: All 4 CI failures are pre-existing on the feat/vapor branch and unrelated to this PR:
Steps component tests all pass locally (53/53). |
Review: fix(steps): add missing props, fix a11y, replace hardcoded colorsGood work overall — the a11y fix (conditional Must fix1. In <component v-if="hasCustomIcon && icon" :is="icon as Component" />
<span v-else-if="isProgressDot" class="ant-steps-icon ant-steps-icon-dot" />
<span v-else class="ant-steps-icon">...</span>The slot-based and number/check/close branches all have the <span v-if="hasCustomIcon && icon" class="ant-steps-icon">
<component :is="icon as Component" />
</span>2.
Options:
I'd recommend (a) to keep this PR focused. 3. <Step v-for="(item, index) in (items || [])" :key="item.title ?? index" .../>If two items have the same title (or both have Should fix4.
5. CSS hardcoded .ant-steps-dot .ant-steps-item-icon { margin-inline-start: 67px; }
.ant-steps-dot .ant-steps-item-process .ant-steps-item-icon { margin-inline-start: 66px; }
.ant-steps-dot .ant-steps-item-tail { margin: 0 0 0 70px; }These magic numbers are brittle and depend on Consider6. This matches Ant Design React's behavior, so it's fine — but it means all existing horizontal Steps will auto-switch to vertical on 7. const mergedSize = computed(() => props.size ?? (globalSize.value === 'sm' ? 'small' : 'default'))ConfigProvider size can be Positive
|
… fix - Wrap icon prop in .ant-steps-icon span for proper styling (vueComponent#1) - Remove unimplemented ProgressDotRender type, keep progressDot as boolean (vueComponent#2) - Use index as v-for key to avoid duplicate key risk (vueComponent#3) - Narrow icon type from Component | string to Component (vueComponent#4) - Add comments for CSS magic numbers and mergedSize mapping (vueComponent#5, vueComponent#7) - Add regression test for icon prop wrapper with markRaw Made-with: Cursor
|
Addressed the review comments:
Also added a regression test for the Verified locally: 54 tests passing across |
Review: fix(steps): add missing props, fix a11y, replace hardcoded colorsThanks for the solid contribution! I reviewed both commits against the project conventions in CLAUDE.md. Tests pass (45/45). Here is my feedback: Positive
Must Fix1. Inline demo does not use The <a-steps
type="inline"
:current="item.current"
:status="item.status"
:items="items"
/>The demo that was on 2. Demo snapshot needs updating after fixing inline demo After fixing the demo, run Should Fix3. Trailing blank line in Steps.vue There is an extra blank line before Consider4. When const classes = computed(() => ({
...
'ant-steps-item-custom': hasCustomIcon.value && !isProgressDot.value,
}))5. Missing comment on The original Overall this is a high-quality PR. The inline demo is the only blocking issue — once fixed, this is ready to merge. Thanks! |
- Rewrite inline demo to use type="inline" with :items prop - Update demo snapshot for inline type - Guard ant-steps-item-custom class when progressDot is active - Add comment on stepIndex side-effect - Remove trailing blank line in Steps.vue Made-with: Cursor
|
Thanks for the detailed review! All points addressed:
All 54 tests passing locally. Let me know if anything else needs adjusting! |
|
Thanks @tangjinzhou for the thorough reviews and for merging! Learned a lot from the feedback. |
Summary
progressDot,items,responsive,inlinetype,iconprop,ProgressDotRendertype,StepIteminterface; removesizedefault to allow ConfigProvider inheritanceuseConfigInjectfor global size,useBreakpointfor responsive auto-vertical; supportitemsprop viav-for; add inline/dot CSS classes; passinitial/progressDot/typevia contextrole="button"only when clickable; supporticonprop rendering; progressDot dot icon;initialoffset in step numbering#fffwith CSS variables for dark theme support; add progressDot and inline type stylesInlinedemo to demo.test.ts; add 7 new test cases (inline type, progressDot, items prop, initial offset, dot icon, conditional role, component names)Test plan
Note:
responsivedefaults totrue(matching Ant Design React), so horizontal Steps switch to vertical onxsscreens. Consumers can set:responsive="false"to opt out.